using ZhaoXi.MSACommerce.CommonServiceClient;
using Zhaoxi.MSACommerce.HttpApi.Common;
using ZhaoXi.MSACommerce.UserService.HttpApi.Apis;

namespace ZhaoXi.MSACommerce.UserService.HttpApi;

public static class DependencyInjection
{
    public static IServiceCollection AddHttpApi(this IServiceCollection services)
    {
        ConfigureUserService(services);

        services.AddHttpApiCommon();
        
        return services;

    }
    
    
    private static void ConfigureUserService(IServiceCollection services)
    {
        services.AddServiceClient<VerificationClient>(option =>
        {
            option.LoadBalancingStrategy = LoadBalancingStrategy.RoundRobin;
        }, client =>
        {
            client.Timeout = TimeSpan.FromSeconds(1);
        });
    }
}